@include('common.header')


<!-- 页面标记  -->
<div class="col-xs-12 col-sm-6 col-md-2" style="text-align:center;color:#32CD32;font-size:25px;margin-top:5%;">
	配置
</div>	
	
<!-- 配置表单  -->	
<div class="col-xs-12 col-sm-6 col-md-10" style="margin-top:8%;" >
	
	<!-- 店铺名称 -->
	<div  class="form-group">
		<label class="col-sm-2 control-label">店铺名称</label>
		<div class="col-sm-10">
			<input style="width:330px;" type="text" name="name" value="{{ $web->name or '' }}" class="form-control"  placeholder="店铺名称" />
		</div>
	</div>
	
	<!-- 网站配置 -->
	<br/><br/>
	<div  class="form-group">
		<label class="col-sm-2 control-label">是否关闭</label>
		<div class="col-sm-10">
			@if( isset($web) && $web->isclose=='1' )
				<input  type="radio" name="isclose" value="1" id="open" checked style="cursor:pointer;" /><label style="cursor:pointer;" for="open">开启</label>
				&nbsp;&nbsp;&nbsp;
				<input  type="radio" name="isclose" value="2" id="close" style="cursor:pointer;" /><label style="cursor:pointer;" for="close">关闭</label>
			@else
				<input  type="radio" name="isclose" value="1" id="open"  style="cursor:pointer;" /><label style="cursor:pointer;" for="open">开启</label>
				&nbsp;&nbsp;&nbsp;
				<input  type="radio" name="isclose" value="2" id="close" checked style="cursor:pointer;" /><label style="cursor:pointer;" for="close">关闭</label>
			@endif
		</div>
	</div>
	
	
	<!--
	<br/><br/>
	<div  class="form-group">
		<label class="col-sm-2 control-label">刷新首页缓存</label>
		<div class="col-sm-10">
			<button id="refresh" style="width:200px;" class="btn btn-default">刷新首页缓存</button>
		</div>
	</div>
	-->
	
	
</div>
	

<div class="col-xs-12 col-sm-6 col-md-12" style="text-align:left;margin-left:20%;">
	<button id="confirm" style="width:300px;margin-top:2%;" class="btn btn-danger">确认配置</button>
</div>	
<div class="col-xs-12 col-sm-6 col-md-12" style="text-align:left;margin-bottom:100px;margin-top:1%;margin-left:20%;">
	<a href ="javascript:history.back();" style="width:300px;" class="btn btn-success">
		返回
	</a>
</div>
	

<script type="text/javascript">
		
	$(function()
	{
		// 配置
		$("#confirm").click(function()
		{
			// 店铺名称
			var name	=	$("input[name='name']").val();
			// 是否关闭
			var isclose	=	$("input[name='isclose']:checked").val();
			$.ajax({ 
				type : 'post', 
				url : "{{ url('/setconfig') }}", 
				data :{name:name,isclose:isclose,_token:_token}, 
				async:true,    					
				dataType:"json",
				success : function(back)
				{ 
					if( back['show_info'].indexOf("成功") > 0 )
					{
						$(".btn-danger").attr('disabled',true);
					}
					$(".opa").html( back['show_info'] );
					$(".opa").slideDown(1000);
					$(".opa").delay(1500).slideUp(1000);
				}
			});
			
		});
	
	
		// 刷新首页缓存
		// $("#refresh").click(function()
		// {
			// $.ajax({ 
				// type : 'get', 
				// url : "http://zhizhu.com/clearIndex", 
				// data :{}, 
				// async:true,    					
				// dataType:"json",
				// success : function(back) { 
					// alert(back['show_info']);
				// }
			// });
			
		// });
		
		
	});

</script>


@extends('common.footer')